<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script type="text/javascript" th:src="@{/home/js/public.js}"></script>
</head>
<style type="text/css">
table tr:nth-child(even) {
	background: #fff
}
</style>
<body>
	<div class="navigation-t">
		<div class="navigation-tl">
			当前位置：<a href="#" onclick="changeMain('home')">主页</a> > 自诊断
		</div>
	</div>
	<div class="project">
		<div class="diagnosis">
			<div class="diagnosis-a">
				<div class="diagnosis-aa">
					<span class="diagnosis-aa-blue" id="infoTitle">自诊断，请点击开始.....</span>
					<!--<span class="diagnosis-aa-blue">自诊断已完成，发现异常</span>
						<span class="diagnosis-aa-red">自诊断已完成，未发现异常</span>-->
				</div>
				<div class="diagnosis-ab" id="info">共3项，请稍候.....</div>
			</div>
			<div class="button-pub" style="float: right; margin-top: -40px">
				<button id="checkZzd" >开始</button>
			</div>
			<div class="diagnosis-b">
				<div class="diagnosis-b-wwc" id="jd" style="width: 1%"></div>
			</div>
			<div class="diagnosis-c">
				<table width="100%" align="center" cellpadding="0" cellspacing="0">
					<tr class="querystate">
						<td valign="top" width="10%"><div id="asd"
								class="querystate-number querystate-wwc"></div></td>
						<td valign="top" width="10%" class="v-top" id="wlzd">未诊断</td>
						<td width="40%" align="left">
							<table width="80%" align="left">
								<tr>
									<td align="right" width="60%">网络连接状态：</td>
									<td align="left" width="40%"><span class="normal" id="wl"></span></td>
								</tr>
								<tr>
									<td align="right">本机IP地址：</td>
									<td align="left" id="localIp"></td>
								</tr>
								<tr>
									<td align="right">检测连接设备的IP地址：</td>
									<td align="left" id="equipmentIP"></td>
								</tr>
							</table>
						</td>
					</tr>
					<tr class="querystate">
						<td valign="top"><div id="cjaz" class="querystate-number"></div></td>
						<td valign="top" class="v-top" id="zdz">未诊断</td>
						<td align="left">
							<table width="80%" align="left">
								<tr>
									<td align="right" width="60%"><b>插件安装状态</b></td>
									<td align="left" width="40%"></td>
								</tr>
								<tr>
									<td align="right">CGM插件：</td>
									<td align="left"><span class="normal" id="cgm"></span></td>
								</tr>
								<tr>
									<td align="right">WRL插件：</td>
									<td align="left"><span class="normal" id="wrl"></span></td>
								</tr>
								<tr>
									<td align="right">U3D插件：</td>
									<td align="left"><span class="normal" id="u3d"></span></td>
								</tr>
								<tr>
									<td align="right">Flash插件：</td>
									<td align="left"><span class="normal" id="flash"></span></td>
								</tr>
								<tr>
									<td align="right">音频插件：</td>
									<td align="left"><span class="normal" id="yp1"></span></td>
								</tr>
								<tr>
									<td align="right">视频插件：</td>
									<td align="left"><span class="normal" id="sp1"></span></td>
								</tr>
							</table>
						</td>
					</tr>
					<tr class="nquerystate">
						<td valign="top"><div id="s1"
								class="nquerystate-number"></div></td>
						<td id="s2" valign="top" class="v-top">未诊断</td>
						<td align="left">
							<table width="80%" align="left">
								<tr>
									<td align="right" width="60%">与各分系统连接状态：</td>
									<td align="left" width="40%"><span id="s3" class="normal"></span></td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</div>
</body>
<script th:inline="javascript">  
/*<![CDATA[*/ 
           
function activeXEnabled(clsid) {  
  var el = document.createElement("div"),  axid = "ax_" + (+new Date()), axobj;
  var result = false;
  document.body.appendChild(el);
  el.innerHTML = '<object id="' + axid + '" classid="clsid:' + clsid + '"></object>';
  axobj = document.getElementById(axid);
 if(axobj.object!=null){
	 result = true;
 }
 document.body.removeChild(el);
 axobj = null;
 el = null;
 return result;
}
//检查第一项
var  fr=0;
function FirstChecker(){

	//信息提示开启
	$('#info').html("共3项，正在进行第1项网络连接状态");
	 if($("#equipmentIP").text()!=""){
		 $("#asd").attr("class", "querystate-wc");
    	 $("#wlzd").html("诊断完成");
    	 $('#wl').html("正常");
	 }else{
		 $("#asd").attr("class", "querystate-gz");
    	 $("#wlzd").html("诊断完成");
       	 $("#wl").attr("class", "abnormal");
    	 $('#wl').html("不正常");
    	 fr++;
  
	 }
	
}
//检查第 二  三 项
 var count;
 function Checker() {
	 count=0;
	//信息提示开启
	$('#info').html("共3项，正在进行第2项插件安装状态");
	//按钮旋转
	 $("#cjaz").attr("class", "querystate-number");
	 $("#zdz").html("诊断中");

    //检测CGM
    var cgm = activeXEnabled("1D4A81CB-25A3-4EB7-A75E-4F8A5386D8F8");
    if (cgm) {
      $('#cgm').html("已安装");
     }else{
  	 $("#cgm").attr("class", "abnormal");
  	 $('#cgm').html("未安装");
  	 count++;
     }
    //wrl
     var wrl = activeXEnabled('86A88967-7A20-11D2-8EDA-00600818EDB1');
    if (wrl) {
     $('#wrl').html("已安装");
    }else{
   	 $("#wrl").attr("class", "abnormal");
  	 $('#wrl').html("未安装");
  	 count++;
     }  
    //检测UnityWebPlayer 444785F1-DE89-4295-863A-D46C3A781394
    var Unity = activeXEnabled('444785F1-DE89-4295-863A-D46C3A781394');
    if (Unity) {
     $('#u3d').html("已安装");
    }else{
   	 $("#u3d").attr("class", "abnormal");
  	 $('#u3d').html("未安装");
  	 count++;
     }
    //检测Flash
    var swf = activeXEnabled("d27cdb6e-ae6d-11cf-96b8-444553540000");
    if (swf) {
      $('#flash').html("已安装");
     }else{
  	 $("#flash").attr("class", "abnormal");
  	 $('#flash').html("未安装");
  	 count++;
     }
  //检测player
    var player = activeXEnabled("6BF52A52-394A-11d3-B153-00C04F79FAA6");
    if (player) {
       $('#yp1').html("已安装");
    }else{
  	 $("#yp1").attr("class", "abnormal");
       $('#yp1').html("未安装");
       count++;
    }
    //检测player
    var player1 = activeXEnabled('6BF52A52-394A-11d3-B153-00C04F79FAA6');
    if (player1) {
       $('#sp1').html("已安装");
    }else{
  	 $("#sp1").attr("class", "abnormal");
     $('#sp1').html("未安装");
       count++;
    }
    $("#jd").width("100%");
    //return count;
  }
var localIp = [[${localIp}]];  
var equipmentIP = [[${equipmentIP}]];  
$('#checkZzd').on('click', function(e) {
	e.preventDefault();
	if(localIp!=null){
		$('#localIp').text(localIp);
	} 
	if(equipmentIP!=null){
	   $('#equipmentIP').text(equipmentIP);
	}  
    FirstChecker(); 
	Checker();

	 if(count>0&&fr>0){
		 $("#asd").attr("class", "querystate-gz");
		 $("#cjaz").attr("class", "querystate-gz");
		 $("#zdz").html("诊断完成");
		 $('#infoTitle').html("自诊断已完成，发现异常");
		 $("#infoTitle").attr("class", "diagnosis-aa-red");
		 $('#info').html("共3项，诊断完成第3项，未发现异常");
	}else if(count>0&&fr==0){
		 $("#cjaz").attr("class", "querystate-gz");
		 $("#zdz").html("诊断完成");
		 $('#infoTitle').html("自诊断已完成，发现异常");
		 $("#infoTitle").attr("class", "diagnosis-aa-red");
		 $('#info').html("共3项，诊断完成第3项，未发现异常");
		
	  }else if(count==0&&fr>0){
			 $("#asd").attr("class", "querystate-gz");
			 $("#cjaz").attr("class", "querystate-wc");
			 $("#zdz").html("诊断完成");
			 $('#infoTitle').html("自诊断已完成，发现异常");
			 $("#infoTitle").attr("class", "diagnosis-aa-red");
			 $('#info').html("共3项，诊断完成第3项，未发现异常");
			
		  }else{
	 	 $('#info').html("共3项，正在进行第2项，未发现异常");
		 $("#cjaz").attr("class", "querystate-wc");
		 $("#zdz").html("诊断完成");
	     $('#info').html("共3项，诊断完成第3项，未发现异常");
		 $('#infoTitle').html("自诊断已完成，未发现异常");
		 $("#infoTitle").attr("class", "diagnosis-aa-blue");
		
	  }  
	 $("#s1").attr("class", "querystate-wc");
	 $("#s2").html("诊断完成");
	 $('#s3').html("正常");
});

/*]]>*/ 
 </script>
</html>
